<template>
  <!--练习验证登录密钥-->
  <view class="AnswerLoginKey">
    <u-popup :show="isPopup" :round="15" mode="bottom" @close="onClose" safe-area-inset-bottom>
      <view class="title">练习密钥</view>
      <view class="info">
        <u--input
            placeholder="请输入密钥"
            customStyle="height: 30px;border:none;border-bottom:1px solid #F2F2F2;padding: 15px 35px;"
            clearable
            v-model="loginKey"
        ></u--input>
      </view>
      <view class="footer">
        <view class="confirm btn" @click="confirm">确定</view>
        <view class="line"></view>
        <view class="close btn" @click="onClose">取消</view>
      </view>
    </u-popup>
  </view>
</template>
<script>
export default {
  name: "AnswerLoginKey",
  data() {
    return {
      isPopup: false,
      loginKey: "",
      item: null
    }
  },
  methods: {
    onClose() {
      this.isPopup = false;
      this.$emit("close")
    },
    async open(item) {
      this.loginKey=""
      this.item = item;
      this.isPopup = true;
    },
    confirm() {
      if (this.loginKey !== this.item.loginKey) {
        uni.showToast({
          title: "请输入正确密钥",
          icon: "none",
          duration: 2000
        });
        return
      }
      this.$emit("success", this.item);
      this.isPopup = false;
    },
  }
}
</script>
<style scoped lang="scss">
.AnswerLoginKey {

  .title {
    color: #333333;
    font-size: 32rpx;
    font-weight: bold;
    text-align: center;
    height: 75px;
    line-height: 75px;
  }

  .operate {
  }

  .btn {
    height: 74px;
    text-align: center;
    line-height: 74px;
    color: #000000;
    font-size: 14px;
  }

  .line {
    width: 100%;
    background-color: #F2F2F2;
    height: 6rpx;
  }
}
</style>